<!DOCTYPE html>
<html lang="en"><head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1"><!-- Begin Jekyll SEO tag v2.8.0 -->
<title>0108: D Snippets IV - Using Arrays in a UI Context | gtkDcoding</title>
<meta name="generator" content="Jekyll v4.3.4" />
<meta property="og:title" content="0108: D Snippets IV - Using Arrays in a UI Context" />
<meta name="author" content="Ron Tarrant" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="This GTK Tutorial covers a D-specific implementation of the Observer pattern." />
<meta property="og:description" content="This GTK Tutorial covers a D-specific implementation of the Observer pattern." />
<link rel="canonical" href="http://localhost:4000/posts/0108-snippets-iv-arrays.html" />
<meta property="og:url" content="http://localhost:4000/posts/0108-snippets-iv-arrays.html" />
<meta property="og:site_name" content="gtkDcoding" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-04-25T00:00:00-04:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="0108: D Snippets IV - Using Arrays in a UI Context" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"Ron Tarrant"},"dateModified":"2020-04-25T00:00:00-04:00","datePublished":"2020-04-25T00:00:00-04:00","description":"This GTK Tutorial covers a D-specific implementation of the Observer pattern.","headline":"0108: D Snippets IV - Using Arrays in a UI Context","mainEntityOfPage":{"@type":"WebPage","@id":"http://localhost:4000/posts/0108-snippets-iv-arrays.html"},"url":"http://localhost:4000/posts/0108-snippets-iv-arrays.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="stylesheet" href="../assets/main.css">
  <link rel="stylesheet" href="../css/style.css" /><link type="application/atom+xml" rel="alternate" href="http://localhost:4000/feed.xml" title="gtkDcoding" /></head>
<body><header class="site-header" role="banner">

  <div class="wrapper"><a class="site-title" rel="author" href="../">gtkDcoding</a><nav class="site-nav">
        <input type="checkbox" id="nav-trigger" class="nav-trigger" />
        <label for="nav-trigger">
          <span class="menu-icon">
            <svg viewBox="0 0 18 15" width="18px" height="15px">
              <path d="M18,1.484c0,0.82-0.665,1.484-1.484,1.484H1.484C0.665,2.969,0,2.304,0,1.484l0,0C0,0.665,0.665,0,1.484,0 h15.032C17.335,0,18,0.665,18,1.484L18,1.484z M18,7.516C18,8.335,17.335,9,16.516,9H1.484C0.665,9,0,8.335,0,7.516l0,0 c0-0.82,0.665-1.484,1.484-1.484h15.032C17.335,6.031,18,6.696,18,7.516L18,7.516z M18,13.516C18,14.335,17.335,15,16.516,15H1.484 C0.665,15,0,14.335,0,13.516l0,0c0-0.82,0.665-1.483,1.484-1.483h15.032C17.335,12.031,18,12.695,18,13.516L18,13.516z"/>
            </svg>
          </span>
        </label>

        <div class="trigger"><a class="page-link" href="../about.html">About</a><a class="page-link" href="../index-reverse.html">Posts in Date Order</a><a class="page-link" href="../topics.html">Blog Posts by Topic</a></div>
      </nav></div>
</header>
<main class="page-content" aria-label="Content">
      <div class="wrapper">
        <article class="post h-entry" itemscope itemtype="http://schema.org/BlogPosting">
	<header class="post-header">
		<link rel="stylesheet" href="../css/font_size.css" />
		<link rel="stylesheet" href="../css/figure.css" />
		<link rel="stylesheet" href="../css/topics/dlang.css" />  <!-- sub in the tag/topic -->
		<link rel="stylesheet" href="../css/modal.css" />
		<link rel="stylesheet" href="../css/post.css" />
		<link rel="stylesheet" href="../css/mascot_effects.css" />

		
		
		<p class="post-meta">
		<time class="dt-published" datetime="2020-04-25T00:00:00-04:00" itemprop="datePublished">Saturday, April 25, 2020
		</time>• by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span class="p-author h-card" itemprop="name">Ron Tarrant</span></span></p>
	</header>

	<div class="post-content e-content" itemprop="articleBody">
		<div class="skew-line"></div>
		<h1 id="0108-d-snippets-iv---using-arrays-in-a-ui-context">0108: D Snippets IV - Using Arrays in a UI Context</h1>

<p>So, what do you do when you need to pick an object out of a bunch/collection/array for special processing? Or deletion?</p>

<p>Last time, we talked about adding and removing <em>Observers</em> from a watched object’s list and this technique ties right into that discussion. It’s the kind of thing that also comes up when you want to remove a tab from a <code class="language-plaintext highlighter-rouge">Notebook</code>.</p>

<p>Let’s have a look at another <em>D</em>-specific trick for hunting down stuff in arrays…</p>

<h2 id="the-countuntil-function">The countUntil() Function</h2>

<!-- 0, 1 -->
<!-- first occurrence of application and terminal screen shots on a single page -->
<div class="screenshot-frame">
	<div class="frame-header">
		Results of this example:
	</div>
	<div class="frame-terminal">
		<figure class="right">
			<img id="img1" src="../images/screenshots/019_dlang/dlang_01_term.png" alt="Current example terminal output" />		<!-- img#, filename -->

			<!-- Modal for terminal shot -->
			<div id="modal1" class="modal">																				<!-- modal# -->
				<span class="close1">&times;</span>																		<!-- close# -->
				<img class="modal-content" id="img11" />																		<!-- img## -->
				<div id="caption"></div>
			</div>
			
			<script>
			// Get the modal
			var modal = document.getElementById("modal1");																	// modal#
			
			// Get the image and insert it inside the modal - use its "alt" text as a caption
			var img = document.getElementById("img1");																		// img#
			var modalImg = document.getElementById("img11");																// img##
			var captionText = document.getElementById("caption");

			img.onclick = function()
			{
			  modal.style.display = "block";
			  modalImg.src = this.src;
			  captionText.innerHTML = this.alt;
			}
			
			// Get the <span> element that closes the modal
			var span = document.getElementsByClassName("close1")[0];														// close#
			
			// When the user clicks on <span> (x), close the modal
			span.onclick = function()
			{ 
				modal.style.display = "none";
			}
			</script>

			<figcaption>
				Current example terminal output (click for enlarged view)
			</figcaption>
		</figure>
	</div>

	<div class="frame-footer">																								<!-- ------------- filename (below) --------- -->
		The code file for this example is available <a href="https://github.com/rontarrant/gtkd_demos/blob/master/019_dlang/dlang_01_find_in_array.d" target="_blank">here</a>.
	</div>
</div>
<!-- end of snippet for first (1st) occurrence of application and terminal screen shots on a single page -->

<p>To use the <code class="language-plaintext highlighter-rouge">countUntil()</code> function, we need to:</p>

<div class="language-d highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">import</span> <span class="n">std</span><span class="p">.</span><span class="n">algorithm</span><span class="p">;</span>
</code></pre></div></div>

<p>To demonstrate this at its simplest, I wrote a quick test where everything takes place in the <code class="language-plaintext highlighter-rouge">main()</code> function:</p>

<div class="language-d highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kt">void</span> <span class="n">main</span><span class="p">(</span><span class="nb">string</span><span class="p">[]</span> <span class="n">args</span><span class="p">)</span>
<span class="p">{</span>
	<span class="kt">int</span><span class="p">[]</span> <span class="n">intArray</span> <span class="p">=</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">46</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">22</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">7</span><span class="p">];</span>
	<span class="nb">string</span><span class="p">[]</span> <span class="n">stringArray</span> <span class="p">=</span> <span class="p">[</span><span class="s">"buzz"</span><span class="p">,</span> <span class="s">"fill"</span><span class="p">,</span> <span class="s">"hope"</span><span class="p">,</span> <span class="s">"negatory"</span><span class="p">,</span> <span class="s">"bobberdoodle"</span><span class="p">];</span>
	<span class="kt">long</span> <span class="n">intIndex</span><span class="p">,</span> <span class="n">stringIndex</span><span class="p">;</span>
	<span class="kt">int</span> <span class="n">findVar</span> <span class="p">=</span> <span class="mi">22</span><span class="p">;</span>
	
	<span class="n">intIndex</span> <span class="p">=</span> <span class="n">intArray</span><span class="p">.</span><span class="n">countUntil</span><span class="p">(</span><span class="mi">22</span><span class="p">);</span>
	<span class="n">writeln</span><span class="p">(</span><span class="s">"intIndex: "</span><span class="p">,</span> <span class="n">intIndex</span><span class="p">);</span>
	<span class="n">intIndex</span> <span class="p">=</span> <span class="n">intArray</span><span class="p">.</span><span class="n">countUntil</span><span class="p">(</span><span class="n">findVar</span><span class="p">);</span>
	<span class="n">writeln</span><span class="p">(</span><span class="s">"intIndex: "</span><span class="p">,</span> <span class="n">intIndex</span><span class="p">);</span>
	
	<span class="n">stringIndex</span> <span class="p">=</span> <span class="n">stringArray</span><span class="p">.</span><span class="n">countUntil</span><span class="p">(</span><span class="s">"negatory"</span><span class="p">);</span>
	<span class="n">writeln</span><span class="p">(</span><span class="s">"stringIndex: "</span><span class="p">,</span> <span class="n">stringIndex</span><span class="p">);</span>
	
<span class="p">}</span> <span class="c1">// main()</span>
</code></pre></div></div>

<p>The beauty of <code class="language-plaintext highlighter-rouge">countUntil()</code> is that it finds the value of the variable you’re looking for and returns the position in the array as a <code class="language-plaintext highlighter-rouge">long</code>. This makes life easy if you’re trying to identify an array element without resorting to such things as object ID’s. And it works whether that value is an integer, a string, or an object reference.</p>

<p>Now let’s put this into a <em>GTK</em> example…</p>

<h2 id="find-a-reference-in-an-array">Find a Reference in an Array</h2>

<!-- 2, 3 -->
<!-- second occurrence of application and terminal screen shots on a single page -->
<div class="screenshot-frame">
	<div class="frame-header">
		Results of this example:
	</div>
	<div class="frame-screenshot">
		<figure>
			<img id="img2" src="../images/screenshots/019_dlang/dlang_02.png" alt="Current example output" />		<!-- img# -->
			
			<!-- Modal for screenshot -->
			<div id="modal2" class="modal">																<!-- modal# -->
				<span class="close2">&times;</span>														<!-- close# -->
				<img class="modal-content" id="img22" />														<!-- img## -->
				<div id="caption"></div>
			</div>
			
			<script>
			// Get the modal
			var modal = document.getElementById("modal2");													// modal#
			
			// Get the image and insert it inside the modal - use its "alt" text as a caption
			var img = document.getElementById("img2");														// img#
			var modalImg = document.getElementById("img22");												// img##
			var captionText = document.getElementById("caption");

			img.onclick = function()
			{
			  modal.style.display = "block";
			  modalImg.src = this.src;
			  captionText.innerHTML = this.alt;
			}
			
			// Get the <span> element that closes the modal
			var span = document.getElementsByClassName("close2")[0];										// close#
			
			// When the user clicks on <span> (x), close the modal
			span.onclick = function()
			{ 
				modal.style.display = "none";
			}
			</script>
			<figcaption>
			Current example output
			</figcaption>
		</figure>
	</div>

	<div class="frame-terminal">
		<figure class="right">
			<img id="img3" src="../images/screenshots/019_dlang/dlang_02_term.png" alt="Current example terminal output" /> 		<!-- img#, filename -->

			<!-- Modal for terminal shot -->
			<div id="modal3" class="modal">																			<!-- modal# -->
				<span class="close3">&times;</span>																	<!-- close# -->
				<img class="modal-content" id="img33" />																	<!-- img## -->
				<div id="caption"></div>
			</div>
			
			<script>
			// Get the modal
			var modal = document.getElementById("modal3");																// modal#
			
			// Get the image and insert it inside the modal - use its "alt" text as a caption
			var img = document.getElementById("img3");																	// img#
			var modalImg = document.getElementById("img33");															// img##
			var captionText = document.getElementById("caption");

			img.onclick = function()
			{
			  modal.style.display = "block";
			  modalImg.src = this.src;
			  captionText.innerHTML = this.alt;
			}
			
			// Get the <span> element that closes the modal
			var span = document.getElementsByClassName("close3")[0];													// close#
			
			// When the user clicks on <span> (x), close the modal
			span.onclick = function()
			{ 
				modal.style.display = "none";
			}
			</script>

			<figcaption>
				Current example terminal output (click for enlarged view)
			</figcaption>
		</figure>
	</div>

	<div class="frame-footer">																							<!--------- filename (below) ------------>
		The code file for this example is available <a href="https://github.com/rontarrant/gtkd_demos/blob/master/019_dlang/dlang_02_reference_in_array.d" target="_blank">here</a>.
	</div>
</div>
<!-- end of snippet for second (2nd) occurrence of application and terminal screen shots on a single page -->

<p>First, a quick note about the imports at the top of the file…</p>

<p>We already talked about this one:</p>

<div class="language-d highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">import</span> <span class="n">std</span><span class="p">.</span><span class="n">algorithm</span><span class="p">;</span>
</code></pre></div></div>

<p>But I’ve added another:</p>

<div class="language-d highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">import</span> <span class="n">std</span><span class="p">.</span><span class="n">conv</span><span class="p">;</span>
</code></pre></div></div>

<p>This isn’t necessary to make <code class="language-plaintext highlighter-rouge">countUntil()</code> work. It’s only here so we can create a bunch of buttons using a <code class="language-plaintext highlighter-rouge">for()</code> loop. I did it this way so we can try this with any number of buttons without having to fiddle around with copying and pasting a bunch of statements.</p>

<p>Moving on…</p>

<p>Until we get to the <code class="language-plaintext highlighter-rouge">AppBox</code> class, things are very much the same as usual, so let’s skip right to it.</p>

<h3 id="the-appbox">The AppBox</h3>

<p>There’s something important we need to keep in mind when creating an array of widgets and it fits neatly into the <em>OOP</em> programming paradigm. It’s this:</p>

<p><em>We can’t access an array from outside its home object without extra smoke and mirrors.</em></p>

<p>In fact, I’d say it’s nigh on impossible, but it doesn’t matter if that’s true or not. It’s bad practice, so I’d advise not doing it. <em>D</em> forces us to use <em>OOP</em> techniques like this in the way they were meant to be used and who are we to question the language designers? When we get to the section of this discussion where we look at the <code class="language-plaintext highlighter-rouge">MyButton</code> object, you’ll see that we reach back up to the <code class="language-plaintext highlighter-rouge">AppBox</code> level to carry out the search for the current <code class="language-plaintext highlighter-rouge">MyButton</code> in the array… and since the array lives in <code class="language-plaintext highlighter-rouge">AppBox</code>, this makes total sense.</p>

<p>Anyway, if my point isn’t clear, it’ll become more so as we go along, so let’s just continue…</p>

<h4 id="appbox-preamble">AppBox Preamble</h4>

<p>Ignoring the properties that are just for the <code class="language-plaintext highlighter-rouge">AppBox</code> itself, we have these:</p>

<div class="language-d highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">MyButton</span><span class="p">[]</span> <span class="n">buttons</span><span class="p">;</span>
<span class="n">MyButton</span> <span class="n">newButton</span><span class="p">;</span>
<span class="kt">int</span> <span class="n">lastButtonID</span> <span class="p">=</span> <span class="p">-</span><span class="mi">1</span><span class="p">;</span>
</code></pre></div></div>

<p>They are:</p>

<ul>
  <li><code class="language-plaintext highlighter-rouge">buttons</code>: an array to hold <code class="language-plaintext highlighter-rouge">MyButton</code> references,</li>
  <li><code class="language-plaintext highlighter-rouge">newButton</code>: a placeholder for each <code class="language-plaintext highlighter-rouge">MyButton</code> created that lasts the lifetime of the <code class="language-plaintext highlighter-rouge">for()</code> loop, just long enough so it can be tacked onto the end of the <code class="language-plaintext highlighter-rouge">buttons</code> array,</li>
  <li><code class="language-plaintext highlighter-rouge">lastButtonID</code>: a unique ID for each button created.</li>
</ul>

<p>That last property isn’t strictly necessary and is only there so we can use it to prove that the code works.</p>

<h4 id="the-appbox-constructor">The AppBox Constructor</h4>

<p>I won’t reproduce the whole thing here, just the bits that concern us in this discussion, which are:</p>

<div class="language-d highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">foreach</span><span class="p">(</span><span class="kt">int</span> <span class="n">i</span><span class="p">;</span> <span class="mf">0..4</span><span class="p">)</span>
<span class="p">{</span>
	<span class="n">lastButtonID</span><span class="p">++;</span>
	<span class="n">newButton</span> <span class="p">=</span> <span class="k">new</span> <span class="n">MyButton</span><span class="p">(</span><span class="n">to</span><span class="p">!</span><span class="nb">string</span><span class="p">(</span><span class="n">lastButtonID</span><span class="p">),</span> <span class="k">this</span><span class="p">);</span>
	<span class="n">packStart</span><span class="p">(</span><span class="n">newButton</span><span class="p">,</span> <span class="n">expand</span><span class="p">,</span> <span class="n">fill</span><span class="p">,</span> <span class="n">localPadding</span><span class="p">);</span>
	<span class="n">buttons</span> <span class="p">~=</span> <span class="n">newButton</span><span class="p">;</span>
<span class="p">}</span>

<span class="k">foreach</span><span class="p">(</span><span class="kt">ulong</span> <span class="n">i</span><span class="p">;</span> <span class="mf">0.</span><span class="p">.</span><span class="n">buttons</span><span class="p">.</span><span class="n">length</span><span class="p">)</span>
<span class="p">{</span>
	<span class="n">writeln</span><span class="p">(</span><span class="s">"Button: "</span><span class="p">,</span> <span class="k">cast</span><span class="p">(</span><span class="n">MyButton</span><span class="p">*)</span><span class="n">buttons</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> <span class="s">", label: "</span><span class="p">,</span> <span class="n">buttons</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">getLabel</span><span class="p">(),</span> <span class="s">", ID: "</span><span class="p">,</span> <span class="n">buttons</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">buttonID</span><span class="p">);</span>
<span class="p">}</span>
</code></pre></div></div>

<p>The first <code class="language-plaintext highlighter-rouge">foreach()</code> loop creates the buttons array, the second lists them all so we can see the RAM location for each.</p>

<p>Notice the use of <code class="language-plaintext highlighter-rouge">to!string()</code> to convert the <code class="language-plaintext highlighter-rouge">lastButtonID</code> integer to a string so it can be used as part of the label text for <code class="language-plaintext highlighter-rouge">MyButton</code>.</p>

<p>One more thing of interest in the <code class="language-plaintext highlighter-rouge">AppBox</code> class is…</p>

<h4 id="the-findbutton-function">The findButton() Function</h4>

<p>And it looks like this:</p>

<div class="language-d highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kt">long</span> <span class="n">findButton</span><span class="p">(</span><span class="n">MyButton</span> <span class="n">findButton</span><span class="p">)</span>
<span class="p">{</span>
	<span class="kt">long</span> <span class="n">index</span> <span class="p">=</span> <span class="n">buttons</span><span class="p">.</span><span class="n">countUntil</span><span class="p">(</span><span class="n">findButton</span><span class="p">);</span>
	
	<span class="k">return</span><span class="p">(</span><span class="n">index</span><span class="p">);</span>
	
<span class="p">}</span> <span class="c1">// findButton()</span>
</code></pre></div></div>

<p>This is called whenever a button is clicked and it returns the index of the clicked button. <em>OOP</em> philosophy demands that this search take place here in the <code class="language-plaintext highlighter-rouge">AppBox</code> because that’s where the array of <code class="language-plaintext highlighter-rouge">MyButton</code> objects lives. This is what I was alluding to earlier. You may be able to find a way to search a reference to the array from inside another object, but I couldn’t find a way to do that… not that I’m an expert in the <em>D</em> language, but my point is, it’s far more trouble than it’s worth. And most of the time, you’ll be looking for the widget’s reference from elsewhere, so I wanted to stress that this is the easy way… perhaps, the only way… to get accurate results.</p>

<p>Moving on…</p>

<h3 id="the-mybutton-class">The MyButton Class</h3>

<p>The preamble looks like this:</p>

<div class="language-d highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">string</span> <span class="n">labelText</span> <span class="p">=</span> <span class="s">"Button "</span><span class="p">;</span>
<span class="kt">int</span> <span class="n">buttonID</span><span class="p">;</span>
<span class="n">AppBox</span> <span class="n">_appBox</span><span class="p">;</span>
</code></pre></div></div>

<p>The <code class="language-plaintext highlighter-rouge">_appBox</code> variable is the reference to our <code class="language-plaintext highlighter-rouge">AppBox</code> and will be used in the <code class="language-plaintext highlighter-rouge">buttonAction</code> callback below.</p>

<p>Since nothing out of the ordinary happens in the constructor—we use the constructor arguments to name the button and assign the <code class="language-plaintext highlighter-rouge">_appBox</code> reference, then hook up the callback—let’s move right along to the callback function itself:</p>

<div class="language-d highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kt">void</span> <span class="n">buttonAction</span><span class="p">(</span><span class="n">Button</span> <span class="n">b</span><span class="p">)</span>
<span class="p">{</span>
	<span class="n">MyButton</span><span class="p">*</span> <span class="n">currentButton</span> <span class="p">=</span> <span class="k">cast</span><span class="p">(</span><span class="n">MyButton</span><span class="p">*)</span><span class="k">this</span><span class="p">;</span>
	<span class="n">writeln</span><span class="p">(</span><span class="s">"Button clicked: "</span><span class="p">,</span> <span class="n">getLabel</span><span class="p">(),</span> <span class="s">", address: "</span><span class="p">,</span> <span class="n">currentButton</span><span class="p">,</span> <span class="s">", ID: "</span><span class="p">,</span> <span class="n">buttonID</span><span class="p">);</span>
	<span class="n">writeln</span><span class="p">(</span><span class="s">"found in the array at index: "</span><span class="p">,</span> <span class="n">_appBox</span><span class="p">.</span><span class="n">findButton</span><span class="p">(</span><span class="k">this</span><span class="p">),</span> <span class="s">"\n"</span><span class="p">);</span>
		
<span class="p">}</span> <span class="c1">// buttonAction()</span>
</code></pre></div></div>

<p>Now, you’ll see a lot of mucking around with <code class="language-plaintext highlighter-rouge">cast()</code>ing and pointers, but take note that when we pass the <code class="language-plaintext highlighter-rouge">MyButton</code> reference to <code class="language-plaintext highlighter-rouge">_appBox.findButton()</code>, we just pass it <code class="language-plaintext highlighter-rouge">this</code>. No pointer, no address, just the actual bare-bulb <code class="language-plaintext highlighter-rouge">this</code> reference.</p>

<p>And that’s how easy this is. Sometimes, life doesn’t have to be difficult… and this is one of those times.</p>

<h2 id="conclusion">Conclusion</h2>

<p>And that’s that. Join me next time when we do something else interesting with the <em>D</em> language and the <em>Gnome Toolkit</em>.</p>

<p>Until then, happy coding.</p>

<div class="blog-nav">
	<div style="float: left;">
		<a href="./0107-dlang-ui-snippets-iii.html">Previous: D Snippets III - A Practical Observer</a>
	</div>
	<div style="float: right;">
		<a href="./0109-sfx-bindproperty.html">Next: Sync Widgets with bindProperty()</a>
	</div>
</div>
<p>
	<h3></h3>
<div class="inpage-frame">
	<a href="https://github.com/sponsors/rontarrant">
		<BR>
		<BR>
		<B>Is this article useful? Educational? Entertaining, perhaps?</B>
		<BR>
		<figure class="left">
			<img src="../images/favorite_32.png" alt="Sponsorship heart" style="width: 32px; height: 32px;">
		</figure>
		You're free to accept or decline this invitation to become our newest sponsor.
	</a>
</div>
	<h4 class="comment-blurb"><B>Comments? Questions? Observations?</B></h4>
	<p>
		Did we miss a tidbit of information that would make this post even more informative? Let's talk about it in the comments.
	</p>
	<script src="https://utteranc.es/client.js"
		repo="rontarrant"
		issue-term="pathname"
		theme="github-light"
		crossorigin="anonymous"
		async>
	</script>
	<ul>
		<li> come on over to the <a href="https://forum.dlang.org/">D Language Forum</a> and look for one of the <i>gtkDcoding</i> announcement posts, </li>
		<li> drop by <a href="https://forum.gtkd.org/">the <i>GtkD Forum</i></a>,</li>
		<li> follow the link below to email me, or</li>
		<li> go to the	<a href="https://www.facebook.com">gtkDcoding Facebook page.</a></li>
	</ul>
</p>
<p> You can also subscribe <a href="/feed.xml">via RSS</a> so you won't miss anything. Thank you very much for dropping by.</p>
<p>&copy; Copyright 2025 Ron Tarrant </p>
</div>

	<a class="u-url" href="./0108-snippets-iv-arrays.html" hidden></a>
</article>

      </div>
    </main><footer class="site-footer h-card">
  <data class="u-url" href="/"></data>

  <div class="wrapper">

    <h2 class="footer-heading">gtkDcoding</h2>

    <div class="footer-col-wrapper">
      <div class="footer-col footer-col-1">
        <ul class="contact-list">
          <li class="p-name">Ron Tarrant</li><li><a class="u-email" href="mailto:gtkDcoding@gmail.com">gtkDcoding@gmail.com</a></li></ul>
      </div>

      <div class="footer-col footer-col-2"><ul class="social-media-list"><li><a href="https://github.com/rontarrant"><svg class="svg-icon"><use xlink:href="../assets/minima-social-icons.svg#github"></use></svg> <span class="username">rontarrant</span></a></li></ul>
</div>

      <div class="footer-col footer-col-3">
        <p>Simple examples of how to use GtkD to build GUI applications.</p>
      </div>
    </div>

  </div>

</footer>
</body>

</html>
